﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TaskManage
{
    public partial class FormMain : Form
    {
        public string uid;
        public string uname;
        public string upriority;

        public FormMain()
        {
            InitializeComponent();
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            // Window maximize
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Text = "任务管理系统 - 欢迎用户 " + uname;
            if (upriority[0] > '3')
            {
                this.UaddToolStripMenuItem.Enabled = false;
                this.TaddToolStripMenuItem.Enabled = false;
            }
        }

        private void UaddToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormUserAdd fua = new FormUserAdd();
            fua.upriority = this.upriority;
            fua.Show();
        }

        private void UchgpwdToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormUserChgpwd fuc = new FormUserChgpwd();
            fuc.uname = this.uname;
            fuc.Show();
        }

        private void UexitToolStripMenuItem_Click(object sender, EventArgs e)
        {
             if (MessageBox.Show("你确定要退出系统吗？", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void TviewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormTaskView ftv = new FormTaskView();
            ftv.uid = this.uid;
            ftv.uname = this.uname;
            ftv.upriority = this.upriority;
            ftv.Show();
        }

        private void TaddToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormTaskAdd fta = new FormTaskAdd();
            fta.uid = this.uid;
            fta.Show();
        }

        private void TsubmitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormTaskSubmitBg ftsb = new FormTaskSubmitBg();
            ftsb.uid = this.uid;
            ftsb.Show();
        }

        private void TaskSearchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormTaskSearch fts = new FormTaskSearch();
            fts.Show();
        }

        private void HaboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormHelpAbout fha = new FormHelpAbout();
            fha.Show();
        }
    }
}
